

const {ccclass, property} = cc._decorator;

@ccclass
export default class UnitView extends cc.Component {

    @property(cc.ProgressBar)
    hpProgressBar: cc.ProgressBar = null;

    data = null;
    onLoad () {
        
    }
    init(data){
        this.data = data;
        this.hpProgressBar.progress = this.data.currentHp/this.data.maxhp;
    }
    change(id: string | number){
      
        if (id == 'currentHp') {
            this.hpProgressBar.progress = this.data.currentHp/this.data.maxhp;
        }
    }
    start () {

    }

    // update (dt) {}
}
